export default {
  mounted(el, binding) {
    const { className, activeClass, curIdx } = binding.value;
    const oNavItems = el.querySelectorAll("." + className);

    oNavItems[curIdx].className += ` ${activeClass}`;
  },

  updated(el, binding) {
    const { className, activeClass, curIdx } = binding.value;
    const oOptions = binding.oldValue;
    const oNavItems = el.querySelectorAll("." + className);
    oNavItems[curIdx].className += ` ${activeClass}`;
    const cls = oNavItems[oOptions.curIdx].className.split(' ').filter(c => c !== activeClass);
    oNavItems[oOptions.curIdx].className = cls.join(' ');
  },
};
